// var o;
// exports.MissionConfig = exports.MissionType = exports.MissionState = exports.MissionMode = void 0;
// var s;
// var c;
// var l;
// var u;
// var p;
// var f;
// var AL_GAME_HUA_i18nMgr = require("./AL_GAME_HUA_i18nMgr");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var AL_GAME_HUA_MissionData = require("./AL_GAME_HUA_MissionData");
// var AL_GAME_HUA_ConfigHandler = require("./AL_GAME_HUA_ConfigHandler");
// var AL_GAME_HUA_GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");
// (f = s = exports.MissionMode || (exports.MissionMode = {}))[(f.DAILY = 0)] = "DAILY";
// f[(f.CONST = 1)] = "CONST";
// (p = c = exports.MissionState || (exports.MissionState = {}))[(p.PROGRESS = 0)] = "PROGRESS";
// p[(p.COMPLETED = 1)] = "COMPLETED";
// p[(p.RECIEVED = 2)] = "RECIEVED";
// (u = l = exports.MissionType || (exports.MissionType = {}))[(u.LOGIN = 0)] = "LOGIN";
// u[(u.LEVEL_DAILY = 1)] = "LEVEL_DAILY";
// u[(u.CHALLENGE = 2)] = "CHALLENGE";
// u[(u.CRASH = 3)] = "CRASH";
// u[(u.PROP0 = 4)] = "PROP0";
// u[(u.PROP1 = 5)] = "PROP1";
// u[(u.PROP2 = 6)] = "PROP2";
// u[(u.PROP3 = 7)] = "PROP3";
// u[(u.PROP4 = 8)] = "PROP4";
// u[(u.PROP5 = 9)] = "PROP5";
// u[(u.PROP6 = 10)] = "PROP6";
// u[(u.REVIVE = 11)] = "REVIVE";
// u[(u.BOX_RECIEVED = 12)] = "BOX_RECIEVED";
// u[(u.STAR_BOX_RECIEVE = 13)] = "STAR_BOX_RECIEVE";
// u[(u.SHARE = 14)] = "SHARE";
// u[(u.VIDEO_DAILY = 15)] = "VIDEO_DAILY";
// u[(u.VIDEO_TOTAL = 16)] = "VIDEO_TOTAL";
// u[(u.LEVEL_TOTAL = 17)] = "LEVEL_TOTAL";
// var y = (function (e) {
//     function t() {
//         var t = (null !== e && e.apply(this, arguments)) || this;
//         t.missionType = null;
//         t.missions = null;
//         t.dailyList = null;
//         t.constList = null;
//         return t;
//     }
//     __extends(t, e);
//     t.getInstance = function () {
//         return this.instance || (this.instance = new t());
//     };
//     t.prototype.destroy = function () {
//         t.instance = null;
//     };
//     t.prototype.jiazai_peizhi = function () {
//         var e = this;
//         return new Promise(function (t, n) {
//             return __awaiter(e, void 0, void 0, function () {
//                 var e;
//                 var o;
//                 return __generator(this, function (i) {
//                     switch (i.label) {
//                         case 0:
//                             e = "Mission";
//                             return [4, this.yibu_jiazai_txt_peizhi(e)];
//                         case 1:
//                             (o = i.sent())
//                                 ? (this.jiexi_shuju(o), this.jiexi_liebiao(), t())
//                                 : (Log.e("[missionConfig]", "missionConfig 配置加载失败:" + e), n());
//                             return [2];
//                     }
//                 });
//             });
//         });
//     };
//     t.prototype.huoqu_renwu_by_id = function (e) {
//         return this.missions[e];
//     };
//     t.prototype.huoqu_renwu_leixing_by_id = function (e) {
//         var t = this.missions[e];
//         return this.missionType[t.type];
//     };
//     t.prototype.huoqu_meiri_renwu_liebiao = function () {
//         var e = [];
//         var t = {};
//         var n = 0;
//         for (var o = this.dailyList; n < o.length; n++) {
//             var i = o[n];
//             var r = i.id;
//             var a = i.type;
//             var s = (i.mode, i.term, this.huoqu_renwu_jindu(r));
//             e.push(s);
//             if (a in t == 0) {
//                 t[a] = 0;
//             }
//             if (!(s.state != c.RECIEVED && s.vipState != c.RECIEVED)) {
//                 t[a]++;
//             }
//         }
//         var l = 0;
//         for (var u = e; l < u.length; l++) {
//             r = (s = u[l]).id;
//             var p = this.missions[r];
//             var f = p.idx;
//             var d = t[(a = p.type)];
//             s.show = f == d || !(f > d);
//         }
//         return e.sort(function (e, t) {
//             return e.order - t.order;
//         });
//     };
//     t.prototype.huoqu_changzhu_renwu_liebiao = function () {
//         var e = [];
//         var t = 0;
//         for (var n = this.constList; t < n.length; t++) {
//             var o = n[t];
//             var i = o.id;
//             var r = (o.type, o.mode, o.term, this.huoqu_renwu_jindu(i));
//             r.show = !0;
//             e.push(r);
//         }
//         return e.sort(function (e, t) {
//             return e.order - t.order;
//         });
//     };
//     t.prototype.huoqu_meiri_renwu_shifou_wancheng = function () {
//         var e = 0;
//         for (var t = this.huoqu_meiri_renwu_liebiao(); e < t.length; e++) {
//             var n = t[e];
//             if (n.state == c.COMPLETED) {
//                 return !0;
//             }
//             if (n.vipState == c.COMPLETED) {
//                 return !0;
//             }
//         }
//         return !1;
//     };
//     t.prototype.huoqu_changzhu_renwu_shifou_wancheng = function () {
//         var e = 0;
//         for (var t = this.huoqu_changzhu_renwu_liebiao(); e < t.length; e++) {
//             if (t[e].state == c.COMPLETED) {
//                 return !0;
//             }
//         }
//         return !1;
//     };
//     t.prototype.huoqu_renwu_shuliang = function (e) {
//         var t = this.missions[e].type;
//         return this.missionType[t].getNum();
//     };
//     t.prototype.tianjia_renwu_shuliang = function (e, t) {
//         if (void 0 === t) {
//             t = 1;
//         }
//         var n = this.missions[e].type;
//         this.missionType[n].addNum(t);
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_MISSION_CHANGE);
//     };
//     t.prototype.huoqu_renwu_shuliang_by_leixing = function (e) {
//         return this.missionType[e].getNum();
//     };
//     t.prototype.tianjia_renwu_shuliang_by_leixing = function (e, t) {
//         if (void 0 === t) {
//             t = 1;
//         }
//         this.missionType[e].addNum(t);
//         AL_APP_SDK_MANAGER.emit(AL_GAME_HUA_Define.GameEvent.ON_MISSION_CHANGE);
//     };
//     t.prototype.huoqu_renwu_jindu = function (e) {
//         var t = AL_GAME_HUA_MissionData.MissionData.getInstance();
//         var n = this.missions[e];
//         var o = n.id;
//         var i = n.type;
//         var r = n.mode;
//         var a = n.term;
//         var l = this.missionType[i];
//         var u = {
//             id: o
//         };
//         var p = o;
//         if (r == s.DAILY) {
//             var f = t.huoqu_meiri_renwu_shifou_yi_jieshou(o);
//             u.state = f ? c.RECIEVED : l.getNum() >= a ? c.COMPLETED : c.PROGRESS;
//             f = t.huoqu_meiri_renwu_vip_shifou_yi_jieshou(o);
//             u.vipState = f ? c.RECIEVED : l.getNum() >= a ? c.COMPLETED : c.PROGRESS;
//         } else {
//             if (r == s.CONST) {
//                 f = t.huoqu_changzhu_renwu_shifou_yi_jieshou(o);
//                 u.state = f ? c.RECIEVED : l.getNum() >= a ? c.COMPLETED : c.PROGRESS;
//                 u.vipState = c.RECIEVED;
//             }
//         }
//         p += u.state == c.RECIEVED && u.vipState == c.RECIEVED ? 1e4 : 0;
//         p -= u.state == c.COMPLETED ? 5e3 : 0;
//         p -= u.vipState == c.COMPLETED ? 5e3 : 0;
//         u.order = p;
//         return u;
//     };
//     t.prototype.jiexi_shuju = function (e) {
//         var t = e.missions;
//         var n = e.desc;
//         this.missions = {};
//         this.missionType = {};
//         var o = {};
//         var i = 0;
//         for (var r = t; i < r.length; i++) {
//             var a = (P = r[i]).reward || [];
//             var s = P.vipReward || [];
//             var c = [];
//             var u = [];
//             for (var p = 0; p < a.length; p += 2) {
//                 c.push({
//                     goodsId: a[p],
//                     num: a[p + 1]
//                 });
//             }
//             for (p = 0; p < s.length; p += 2) {
//                 u.push({
//                     goodsId: s[p],
//                     num: s[p + 1]
//                 });
//             }
//             P.type in o == 0 ? (o[P.type] = 0) : o[P.type]++;
//             this.missions[P.id] = {
//                 id: P.id,
//                 vip: P.vip,
//                 type: P.type,
//                 mode: P.mode,
//                 term: P.term,
//                 reward: c,
//                 vipReward: u,
//                 idx: o[P.type]
//             };
//         }
//         var f = AL_GAME_HUA_MissionData.MissionData.getInstance();
//         var d = 0;
//         for (var h = n; d < h.length; d++) {
//             var P;
//             var g = void 0;
//             var y = void 0;
//             switch ((P = h[d]).type) {
//                 case l.LOGIN:
//                     g = function () {
//                         return f.loginDaily;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.loginDaily += e;
//                     };
//                     break;
//                 case l.LEVEL_DAILY:
//                     g = function () {
//                         return f.levelDaily;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.levelDaily += e;
//                     };
//                     break;
//                 case l.CHALLENGE:
//                     g = function () {
//                         return f.challengeDaily;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.challengeDaily += e;
//                     };
//                     break;
//                 case l.CRASH:
//                     g = function () {
//                         return f.crashDaily;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.crashDaily += e;
//                     };
//                     break;
//                 case l.PROP0:
//                     g = function () {
//                         return f.useProp0;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.useProp0 += e;
//                     };
//                     break;
//                 case l.PROP1:
//                     g = function () {
//                         return f.useProp1;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.useProp1 += e;
//                     };
//                     break;
//                 case l.PROP2:
//                     g = function () {
//                         return f.useProp2;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.useProp2 += e;
//                     };
//                     break;
//                 case l.PROP3:
//                     g = function () {
//                         return f.useProp3;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.useProp3 += e;
//                     };
//                     break;
//                 case l.PROP4:
//                     g = function () {
//                         return f.useProp4;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.useProp4 += e;
//                     };
//                     break;
//                 case l.PROP5:
//                     g = function () {
//                         return f.useProp5;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.useProp5 += e;
//                     };
//                     break;
//                 case l.PROP6:
//                     g = function () {
//                         return f.useProp6;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.useProp6 += e;
//                     };
//                     break;
//                 case l.REVIVE:
//                     g = function () {
//                         return f.revive;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.revive += e;
//                     };
//                     break;
//                 case l.BOX_RECIEVED:
//                     g = function () {
//                         return f.boxRecieved;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.boxRecieved += e;
//                     };
//                     break;
//                 case l.STAR_BOX_RECIEVE:
//                     g = function () {
//                         return f.starBoxRecieved;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.starBoxRecieved += e;
//                     };
//                     break;
//                 case l.SHARE:
//                     g = function () {
//                         return f.share;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.share += e;
//                     };
//                     break;
//                 case l.VIDEO_DAILY:
//                     g = function () {
//                         return f.watchAdDaily;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.watchAdDaily += e;
//                     };
//                     break;
//                 case l.VIDEO_TOTAL:
//                     g = function () {
//                         return f.watchAdTotal;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.watchAdTotal += e;
//                     };
//                     break;
//                 case l.LEVEL_TOTAL:
//                     g = function () {
//                         return f.levelTotal;
//                     };
//                     y = function (e) {
//                         if (void 0 === e) {
//                             e = 1;
//                         }
//                         f.levelTotal += e;
//                     };
//             }
//             this.missionType[P.type] = {
//                 type: P.type,
//                 title: P.title,
//                 desc: P.desc,
//                 bundle: P.bundle,
//                 icon: P.icon,
//                 getNum: g,
//                 addNum: y
//             };
//         }
//     };
//     t.prototype.jiexi_liebiao = function () {
//         var e = [];
//         var t = [];
//         for (var n in this.missions)
//             this.missions[n].mode == s.DAILY ? e.push(this.missions[n]) : t.push(this.missions[n]);
//         this.dailyList = e;
//         this.constList = t;
//     };
//     t.prototype.get_Mission_Desc = function (e) {
//         var t = this.missions[e].term;
//         var n = this.missions[e].type;
//         var o = this.missionType[n];
//         var i = o.desc;
//         var r = o.title;
//         var a = o.icon;
//         var s = o.bundle;
//         var c = [
//             l.LEVEL_DAILY,
//             l.CRASH,
//             l.REVIVE,
//             l.VIDEO_DAILY,
//             l.REVIVE,
//             l.BOX_RECIEVED,
//             l.STAR_BOX_RECIEVE,
//             l.LEVEL_TOTAL,
//             l.VIDEO_TOTAL,
//             l.SHARE
//         ];
//         var u = [l.PROP0, l.PROP1, l.PROP2, l.PROP3, l.PROP4, l.PROP5, l.PROP6];
//         if (-1 != c.indexOf(n)) {
//             i = AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian(i, [t.toString()]);
//         } else {
//             if (-1 != u.indexOf(n)) {
//                 var p = u.indexOf(n) + 2;
//                 var f = AL_GAME_HUA_GoodsConfig.GoodsConfig.getInstance();
//                 var _ = AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian(f.huoqu_shangpin_miaoshu(p).name);
//                 i = AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian(i, [t.toString(), _]);
//                 r = AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian(r, [_]);
//             } else {
//                 i = AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian(i);
//                 r = AL_GAME_HUA_i18nMgr.i18nMgr._huoqu_biaoqian(r);
//             }
//         }
//         return {
//             type: n,
//             title: r,
//             icon: a,
//             bundle: s ? AL_GAME_HUA_Define.Define.GAME_NAME + "_" + s : "",
//             desc: i
//         };
//     };
//     t.instance = null;
//     return t;
// })(AL_GAME_HUA_ConfigHandler.ConfigHandler);
// exports.MissionConfig = y;


// 导入所需模块
const i18nMgr = require("./AL_GAME_HUA_i18nMgr");
const Define = require("./AL_GAME_HUA_Define");
const MissionDataModule = require("./AL_GAME_HUA_MissionData");
const ConfigHandler = require("./AL_GAME_HUA_ConfigHandler");
const GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");

// 定义任务模式的枚举
const MissionMode = {
    DAILY: 0,
    CONST: 1
};
exports.MissionMode = MissionMode;

// 定义任务状态的枚举
const MissionState = {
    PROGRESS: 0,
    COMPLETED: 1,
    RECIEVED: 2
};
exports.MissionState = MissionState;

// 定义任务类型的枚举
const MissionType = {
    LOGIN: 0,
    LEVEL_DAILY: 1,
    CHALLENGE: 2,
    CRASH: 3,
    PROP0: 4,
    PROP1: 5,
    PROP2: 6,
    PROP3: 7,
    PROP4: 8,
    PROP5: 9,
    PROP6: 10,
    REVIVE: 11,
    BOX_RECIEVED: 12,
    STAR_BOX_RECIEVE: 13,
    SHARE: 14,
    VIDEO_DAILY: 15,
    VIDEO_TOTAL: 16,
    LEVEL_TOTAL: 17
};
exports.MissionType = MissionType;

/**
 * 任务配置类
 */
class MissionConfig extends ConfigHandler.ConfigHandler {
    constructor() {
        super();
        this.missionType = null;
        this.missions = null;
        this.dailyList = null;
        this.constList = null;
    }

    /**
     * 获取单例实例
     */
    static getInstance() {
        if (!this.instance) {
            this.instance = new MissionConfig();
        }
        return this.instance;
    }

    /**
     * 销毁单例
     */
    destroy() {
        MissionConfig.instance = null;
    }

    /**
     * 加载配置
     */
    async jiazai_peizhi() {
        try {
            const configName = "Mission";
            const configData = await this.yibu_jiazai_txt_peizhi(configName);
            if (configData) {
                this.jiexi_shuju(configData);
                this.jiexi_liebiao();
            } else {
                console.error("[missionConfig]", `missionConfig 配置加载失败: ${configName}`);
            }
        } catch (error) {
            console.error(error);
        }
    }

    /**
     * 根据任务ID获取任务
     */
    huoqu_renwu_by_id(id) {
        return this.missions[id];
    }

    /**
     * 根据任务ID获取任务类型
     */
    huoqu_renwu_leixing_by_id(id) {
        const mission = this.missions[id];
        return this.missionType[mission.type];
    }

    /**
     * 获取每日任务列表
     */
    huoqu_meiri_renwu_liebiao() {
        const missionList = [];
        const typeCounter = new Map();

        for (const mission of this.dailyList) {
            const { id, type } = mission;
            const missionProgress = this.huoqu_renwu_jindu(id);
            missionList.push(missionProgress);

            if (!typeCounter.has(type)) {
                typeCounter.set(type, 0);
            }

            if (missionProgress.state !== MissionState.RECIEVED && missionProgress.vipState !== MissionState.RECIEVED) {
                typeCounter.set(type, typeCounter.get(type) + 1);
            }
        }

        for (const progress of missionList) {
            const mission = this.missions[progress.id];
            const index = mission.idx;
            const count = typeCounter.get(mission.type);
            progress.show = index === count || !(index > count);
        }

        return missionList.sort((a, b) => a.order - b.order);
    }

    /**
     * 获取常驻任务列表
     */
    huoqu_changzhu_renwu_liebiao() {
        const missionList = [];

        for (const mission of this.constList) {
            const missionProgress = this.huoqu_renwu_jindu(mission.id);
            missionProgress.show = true;
            missionList.push(missionProgress);
        }

        return missionList.sort((a, b) => a.order - b.order);
    }

    /**
     * 检查每日任务是否完成
     */
    huoqu_meiri_renwu_shifou_wancheng() {
        return this.huoqu_meiri_renwu_liebiao().some(progress =>
            progress.state === MissionState.COMPLETED || progress.vipState === MissionState.COMPLETED
        );
    }

    /**
     * 检查常驻任务是否完成
     */
    huoqu_changzhu_renwu_shifou_wancheng() {
        return this.huoqu_changzhu_renwu_liebiao().some(progress => progress.state === MissionState.COMPLETED);
    }

    /**
     * 获取任务数量
     */
    huoqu_renwu_shuliang(id) {
        const missionType = this.missions[id].type;
        return this.missionType[missionType].getNum();
    }

    /**
     * 添加任务数量
     */
    tianjia_renwu_shuliang(id, increment = 1) {
        const missionType = this.missions[id].type;
        this.missionType[missionType].addNum(increment);
        AL_APP_SDK_MANAGER.emit(Define.GameEvent.ON_MISSION_CHANGE);
    }

    /**
     * 获取任务类型数量
     */
    huoqu_renwu_shuliang_by_leixing(type) {
        return this.missionType[type].getNum();
    }

    /**
     * 添加任务类型数量
     */
    tianjia_renwu_shuliang_by_leixing(type, increment = 1) {
        this.missionType[type].addNum(increment);
        AL_APP_SDK_MANAGER.emit(Define.GameEvent.ON_MISSION_CHANGE);
    }

    /**
     * 获取任务进度
     */
    huoqu_renwu_jindu(id) {
        const MissionData = MissionDataModule.MissionData.getInstance();
        const mission = this.missions[id];
        const { type, mode, term } = mission;
        const missionType = this.missionType[type];
        const progress = { id };

        if (mode === MissionMode.DAILY) {
            const dailyReceived = MissionData.huoqu_meiri_renwu_shifou_yi_jieshou(id);
            progress.state = dailyReceived ? MissionState.RECIEVED 
                : missionType.getNum() >= term ? MissionState.COMPLETED : MissionState.PROGRESS;

            const vipReceived = MissionData.huoqu_meiri_renwu_vip_shifou_yi_jieshou(id);
            progress.vipState = vipReceived ? MissionState.RECIEVED 
                : missionType.getNum() >= term ? MissionState.COMPLETED : MissionState.PROGRESS;
        } else if (mode === MissionMode.CONST) {
            const constReceived = MissionData.huoqu_changzhu_renwu_shifou_yi_jieshou(id);
            progress.state = constReceived ? MissionState.RECIEVED 
                : missionType.getNum() >= term ? MissionState.COMPLETED : MissionState.PROGRESS;
            progress.vipState = MissionState.RECIEVED;
        }

        progress.order = id;
        if (progress.state === MissionState.RECIEVED && progress.vipState === MissionState.RECIEVED) {
            progress.order += 10000;
        }
        if (progress.state === MissionState.COMPLETED) {
            progress.order -= 5000;
        }
        if (progress.vipState === MissionState.COMPLETED) {
            progress.order -= 5000;
        }
        
        return progress;
    }

    /**
     * 解析数据信息
     */
    jiexi_shuju(data) {
        const { missions, desc } = data;
        this.missions = {};
        this.missionType = {};
        const typeCounter = {};

        for (const mission of missions) {
            const reward = mission.reward || [];
            const vipReward = mission.vipReward || [];
            const parsedReward = [];
            const parsedVipReward = [];

            for (let i = 0; i < reward.length; i += 2) {
                parsedReward.push({ goodsId: reward[i], num: reward[i + 1] });
            }
            for (let i = 0; i < vipReward.length; i += 2) {
                parsedVipReward.push({ goodsId: vipReward[i], num: vipReward[i + 1] });
            }

            if (!(mission.type in typeCounter)) {
                typeCounter[mission.type] = 0;
            }

            this.missions[mission.id] = {
                id: mission.id,
                vip: mission.vip,
                type: mission.type,
                mode: mission.mode,
                term: mission.term,
                reward: parsedReward,
                vipReward: parsedVipReward,
                idx: typeCounter[mission.type]++
            };
        }

        const MissionData = MissionDataModule.MissionData.getInstance();

        for (const item of desc) {
            let getNumFunc;
            let addNumFunc;
            
            switch (item.type) {
                case MissionType.LOGIN:
                    getNumFunc = () => MissionData.loginDaily;
                    addNumFunc = (count = 1) => { MissionData.loginDaily += count; };
                    break;
                case MissionType.LEVEL_DAILY:
                    getNumFunc = () => MissionData.levelDaily;
                    addNumFunc = (count = 1) => { MissionData.levelDaily += count; };
                    break;
                case MissionType.CHALLENGE:
                    getNumFunc = () => MissionData.challengeDaily;
                    addNumFunc = (count = 1) => { MissionData.challengeDaily += count; };
                    break;
                case MissionType.CRASH:
                    getNumFunc = () => MissionData.crashDaily;
                    addNumFunc = (count = 1) => { MissionData.crashDaily += count; };
                    break;
                case MissionType.PROP0:
                    getNumFunc = () => MissionData.useProp0;
                    addNumFunc = (count = 1) => { MissionData.useProp0 += count; };
                    break;
                case MissionType.PROP1:
                    getNumFunc = () => MissionData.useProp1;
                    addNumFunc = (count = 1) => { MissionData.useProp1 += count; };
                    break;
                case MissionType.PROP2:
                    getNumFunc = () => MissionData.useProp2;
                    addNumFunc = (count = 1) => { MissionData.useProp2 += count; };
                    break;
                case MissionType.PROP3:
                    getNumFunc = () => MissionData.useProp3;
                    addNumFunc = (count = 1) => { MissionData.useProp3 += count; };
                    break;
                case MissionType.PROP4:
                    getNumFunc = () => MissionData.useProp4;
                    addNumFunc = (count = 1) => { MissionData.useProp4 += count; };
                    break;
                case MissionType.PROP5:
                    getNumFunc = () => MissionData.useProp5;
                    addNumFunc = (count = 1) => { MissionData.useProp5 += count; };
                    break;
                case MissionType.PROP6:
                    getNumFunc = () => MissionData.useProp6;
                    addNumFunc = (count = 1) => { MissionData.useProp6 += count; };
                    break;
                case MissionType.REVIVE:
                    getNumFunc = () => MissionData.revive;
                    addNumFunc = (count = 1) => { MissionData.revive += count; };
                    break;
                case MissionType.BOX_RECIEVED:
                    getNumFunc = () => MissionData.boxRecieved;
                    addNumFunc = (count = 1) => { MissionData.boxRecieved += count; };
                    break;
                case MissionType.STAR_BOX_RECIEVE:
                    getNumFunc = () => MissionData.starBoxRecieved;
                    addNumFunc = (count = 1) => { MissionData.starBoxRecieved += count; };
                    break;
                case MissionType.SHARE:
                    getNumFunc = () => MissionData.share;
                    addNumFunc = (count = 1) => { MissionData.share += count; };
                    break;
                case MissionType.VIDEO_DAILY:
                    getNumFunc = () => MissionData.watchAdDaily;
                    addNumFunc = (count = 1) => { MissionData.watchAdDaily += count; };
                    break;
                case MissionType.VIDEO_TOTAL:
                    getNumFunc = () => MissionData.watchAdTotal;
                    addNumFunc = (count = 1) => { MissionData.watchAdTotal += count; };
                    break;
                case MissionType.LEVEL_TOTAL:
                    getNumFunc = () => MissionData.levelTotal;
                    addNumFunc = (count = 1) => { MissionData.levelTotal += count; };
                    break;
            }

            this.missionType[item.type] = {
                type: item.type,
                title: item.title,
                desc: item.desc,
                bundle: item.bundle,
                icon: item.icon,
                getNum: getNumFunc,
                addNum: addNumFunc
            };
        }
    }

    /**
     * 解析任务列表
     */
    jiexi_liebiao() {
        this.dailyList = [];
        this.constList = [];

        for (const mission of Object.values(this.missions)) {
            if (mission.mode === MissionMode.DAILY) {
                this.dailyList.push(mission);
            } else {
                this.constList.push(mission);
            }
        }
    }

    /**
     * 获取任务描述
     */
    get_Mission_Desc(id) {
        const mission = this.missions[id];
        const { term, type } = mission;
        const missionType = this.missionType[type];
        let { desc, title, icon, bundle } = missionType;

        const dailyTypes = [
            MissionType.LEVEL_DAILY,
            MissionType.CRASH,
            MissionType.REVIVE,
            MissionType.VIDEO_DAILY,
            MissionType.REVIVE,
            MissionType.BOX_RECIEVED,
            MissionType.STAR_BOX_RECIEVE,
            MissionType.LEVEL_TOTAL,
            MissionType.VIDEO_TOTAL,
            MissionType.SHARE
        ];

        const propTypes = [
            MissionType.PROP0, MissionType.PROP1, MissionType.PROP2,
            MissionType.PROP3, MissionType.PROP4, MissionType.PROP5, MissionType.PROP6
        ];

        if (dailyTypes.includes(type)) {
            desc = i18nMgr.i18nMgr._huoqu_biaoqian(desc, [term.toString()]);
        } else if (propTypes.includes(type)) {
            const index = propTypes.indexOf(type) + 2;
            const goodsDesc = GoodsConfig.GoodsConfig.getInstance().huoqu_shangpin_miaoshu(index).name;
            const goodsName = i18nMgr.i18nMgr._huoqu_biaoqian(goodsDesc);
            desc = i18nMgr.i18nMgr._huoqu_biaoqian(desc, [term.toString(), goodsName]);
            title = i18nMgr.i18nMgr._huoqu_biaoqian(title, [goodsName]);
        } else {
            desc = i18nMgr.i18nMgr._huoqu_biaoqian(desc);
            title = i18nMgr.i18nMgr._huoqu_biaoqian(title);
        }

        return {
            type,
            title,
            icon,
            bundle: bundle ? `${Define.Define.GAME_NAME}_${bundle}` : "",
            desc
        };
    }
}

MissionConfig.instance = null;
exports.MissionConfig = MissionConfig;